package com.sxu.fighting.day2;

/**
 * 392 判断是否是子串
 */
public class Test2 {
    // 双指针
    public boolean isSubsequence(String s, String t) {
        int slen = s.length();
        int tlen = t.length();
        int slow = 0,quick = 0;
        while(slow < slen && quick < tlen){
            if(s.charAt(slow) == t.charAt(quick))
                slow++;
            quick++;
        }
        return slow == slen;
    }
}
